#include "loginresponsemessage.h"

LoginResponseMessage::LoginResponseMessage(const Status& status, const Reason& reason)
{
    m_messageType = MessageType::LoginResponse;
    m_status = status;
    m_reason = reason;
}

LoginResponseMessage::LoginResponseMessage(const QJsonObject& jsonObj)
{
    m_messageType = static_cast<MessageType>(jsonObj[JsonKey::TYPE].toInt());
    m_status = jsonObj[JsonKey::STATUS].toString();
    m_reason = jsonObj[JsonKey::REASON].toString();
}

QJsonObject LoginResponseMessage::PackJsonData() const
{
    QJsonObject jsonObj;
    jsonObj[JsonKey::TYPE] = static_cast<int>(m_messageType);
    jsonObj[JsonKey::STATUS] = m_status;
    jsonObj[JsonKey::REASON] = m_reason;
    return jsonObj;
}

Status LoginResponseMessage::getStatus() const
{
    return m_status;
}

Reason LoginResponseMessage::getReason() const
{
    return m_reason;
}
